/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.clinicsolution.persistencia.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Patricia Rocheulle
 */
public abstract class GenericDaoImpl <T>{

    public static Connection conexao;
    public static ResourceBundle sqlProps;

    static {
        sqlProps = ResourceBundle.getBundle("br.com.clinicsolution.util.comandos_sql");
    }

    public abstract Boolean inserir(T o);

    public abstract T consultar(String key);

    public abstract  Boolean editar(T o);

    public static void closeResultSet(ResultSet r) {
        try {
            r.close();
        } catch (SQLException ex) {
            Logger.getLogger(GenericDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void closeStatement(PreparedStatement p) {
        try {
            p.close();
        } catch (SQLException ex) {
            Logger.getLogger(GenericDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void closeConnection(Connection c) {
        try {
            c.close();
        } catch (SQLException ex) {
            Logger.getLogger(GenericDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}
